<?php /* Smarty version 2.6.26, created on 2018-07-25 15:49:19
         compiled from E:%5CWWW%5C40.125.208.171%5Cvweb/admin%5Ctemplates/goods_sku/edit.html */ ?>
<style type="text/css">
.connect_box{ display:none;}
.event_key{ display:none;}
</style>  
	<table width="100%" class="etable">
	<?php if ($_GET['pid'] == '' || $_GET['pid'] == '0'): ?>  
		<tr>
			<td width="80">所属分类</td>
			<td><div class="cats_list"></div></td>
			<input type="hidden" value="<?php echo $this->_tpl_vars['row']['cid']; ?>
" id="cid"/>
	  	</tr>
	<?php endif; ?>		
		<tr>
			<td width="80" id="attr_val_2">规格名</td>
			<td><input name="name" type="text" size="38" id="name" value="<?php echo $this->_tpl_vars['row']['name']; ?>
" placeholder="必填选项"/></td>
	  	</tr>
		<tr>
			<td>排序</td>
			<td><input name="px" type="text" size="12" id="px" value="<?php echo $this->_tpl_vars['row']['px']; ?>
"/></td>
	  	</tr> 
	</table> 
<script type="text/javascript"> 
<?php if ($this->_tpl_vars['row']['cid']): ?>
	category_list('<?php echo $this->_tpl_vars['row']['cid']; ?>
');	
<?php else: ?>
	category_next('0');	
<?php endif; ?>
function ajax_submit(){ 
	<?php if ($_GET['pid'] == '' || $_GET['pid'] == '0'): ?>  
		var cid = $('#cid').val(); 
		var pid = '0';  
	<?php else: ?> 
		var cid = '0'; 
		var pid = '<?php echo $_GET['pid']; ?>
'; 
	<?php endif; ?>
	var name = $("#name").val();
	var px = $("#px").val();
	$.post('?m=goods_sku&a=save',{<?php if ($this->_tpl_vars['row']['id']): ?>id:<?php echo $this->_tpl_vars['row']['id']; ?>
,<?php endif; ?> pid:pid, cid:cid, name:name, px:px},function(result){ 
		data = jQuery.parseJSON(result); 
		if(data.error == '0'){ 
			parent.ajax_flush();
			parent.ajax_close();
		}else{
			$.alert(data.msg);
		} 
	});
}  
$(function(){ 
	var tcid = $("#tcid").val();
	if(tcid != '0'){
		$("#gcid_box").hide();
		$("#attr_val_1").html('添加规格值');
		$("#attr_val_2").html('属性值'); 
	}else{
		$("#gcid_box").show(); 
		$("#attr_val_1").html('添加规格名');
		$("#attr_val_2").html('属性名'); 
	} 
	<?php if ($_GET['id'] != ''): ?>
		$("#gcid_box").hide(); 
	<?php endif; ?>
});
</script>